{% extends "mweb/base.html" %}

<!-- CONTENT
  =====================================================================-->

{% block content %}
<div class="page__hd">
    <h1 class="page__title"> JS交互测试 </h1>
</div>

<div class="page__bd">
    <div class="button-sp-area">
        <a href="javascript:openPayPage()" class="weui-btn weui-btn_primary">打开充值页面</a>
        <a href="javascript:openUserHomepage()" class="weui-btn weui-btn_primary">打开个人主页</a>
        <a href="javascript:enterRoom()" class="weui-btn weui-btn_primary">进入房间</a>
        <a href="javascript:openH5Page()" class="weui-btn weui-btn_primary">打开H5页面</a>
        <a href="javascript:openEggGame()" class="weui-btn weui-btn_primary">打开砸蛋页面</a>
        <a href="javascript:openEggGameV2()" class="weui-btn weui-btn_primary">打开砸蛋页面V2</a>
        <a href="javascript:jumpToNoblePage()" class="weui-btn weui-btn_primary">打开贵族页面</a>
        <a href="javascript:jumpToChat()" class="weui-btn weui-btn_primary">打开聊天页面</a>

        <a href="haibao://openwebview?url=https%3A%2F%2Fcn.bing.com" class="weui-btn weui-btn_primary">scheme跳转</a>
        <a href="alipays://openwebview?url=https%3A%2F%2Fcn.bing.com" class="weui-btn weui-btn_primary">scheme跳转至支付宝</a>
        <a href="javascript:testCleanCache()" class="weui-btn weui-btn_primary">测试清除缓存</a>
    </div>
</div>

<div class="page__ft j_bottom">
    <a href="{% url 'gma:home' %}">
        <span class="bottom-logo">
           HiBao
       </span>
    </a>
</div>

{% endblock content %}

<!-- SCRIPT
  =====================================================================-->

{% block extra_js %}
<script>
function openPayPage() {
    let params = {
        'url': 'haibao://jumpToRechargePage'
    };
    call_native_function('jump', params);
}

function openH5Page() {
    let params = {
        'url': 'haibao://openwebview?url=https%3A%2F%2Fcn.bing.com'
    };
    call_native_function('jump', params);
}

function enterRoom() {
    let params = {
        'url': 'haibao://enterRoom?roomid=10691950'
    };
    call_native_function('jump', params);
}

function openUserHomepage() {
    let params = {
        'url': 'haibao://enterUserHomepage?uid=10691950'
    };
    call_native_function('jump', params);
}

function openEggGame() {
    let params = {
        'url': 'haibao://openEggGame'
    };
    call_native_function('jump', params);
}

function openEggGameV2() {
    let params = {
        'url': 'haibao://openEggGameV2'
    };
    call_native_function('jump', params);
}

function jumpToNoblePage() {
    let params = {
        'url': 'haibao://jumpToNoblePage'
    };
    call_native_function('jump', params);
}

function jumpToChat() {
    let params = {
        'url': 'haibao://jumpToChat?uid=10691950&uname=%F0%9F%A4%92%F0%9F%A4%92%F0%9F%A4%92%F0%9F%A4%92%F0%9F%A5%B0%F0%9F%A5%B0%F0%9F%A5%B0%F0%9F%A5%B0&avatarUrl=https%3A%2F%2Fauth.yyzb.com%2Favatar%2F10691950_1575706742'
    };
    call_native_function('jump', params);
}

function testCleanCache() {
    call_test_function()
}

</script>
{% endblock extra_js %}